package com.sky.controller.user;

import com.sky.constant.ShopStatusConstant;
import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user/shop")
@Api(tags = "用户端营业状态")
public class UsreShopController {

    @Autowired // // 注入操作Redis数据库的对象
    RedisTemplate redisTemplate;

    /**
     * 获取管理端营业状态
     * @return
     */
    @GetMapping("/status")
    @ApiOperation(value = "获取店铺营业状态")
    public Result userStatusGet(){
        // 使用result数据库封装类对象,操作result数据库
        return Result.success(redisTemplate.opsForValue().get(ShopStatusConstant.SHOP_STATUS));
    }
}
